package com.zyj.springboothapim.service.impl;

import com.zyj.springboothapim.bean.Room;
import com.zyj.springboothapim.mapper.AdminMapper;
import com.zyj.springboothapim.mapper.RoomMapper;
import com.zyj.springboothapim.service.RoomService;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoomServiceImpl implements RoomService
{

    private RoomMapper roomMapper;
    @Autowired
    public void setRoomMapper(RoomMapper roomMapper){this.roomMapper = roomMapper;}

    //房屋信息查询
//    @Select("select * from parking_table")
    @Override
    public List<Room> selectRoom()
    {
        return roomMapper.selectRoom();
    }

    //添加禁售房屋
//    @Update("update room_table set room_type='禁售' where room_type=#{roomType}")
    @Override
    public void banRoom(Room room)
    {
        room.setState("禁售");
        roomMapper.banRoom(room);
    }

    //添加销售房屋
//    @Update("update room_table set room_type='销售' where room_type=#{roomType}")
    @Override
    public void saleRoom(Room room)
    {
        room.setState("销售");
        roomMapper.saleRoom(room);
    }
}
